f = open('images.xml','w+');
f.writelines(['<?xml version="1.0" encoding="utf-8" standalone="yes"?>\r\n',
'<images>\r\n']);
i = 1;
while (i <= 54):
	try:
		c = open('./fg/gallery/c'+str(i)+'.txt', 'r');
		cap = c.readline();
		c.close();
	except:
		cap = "no caption";
		
	f.writelines(['<pic>\r\n','\t<image>fg/gallery/i'+str(i)+'.jpg</image>\r\n',
	'\t<thumbnail>fg/gallery/i'+str(i)+'thumb.jpg</thumbnail>\r\n',
	'\t<caption>'+cap+'</caption>\r\n',
	'</pic>\r\n'])
	i = i + 1;
f.writelines(['</images>\r\n']);
f.close();
	